package cn.wolfcode.redis.service.impl;

import cn.wolfcode.redis.service.IViewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

@Service
public class ViewServiceImpl implements IViewService {

    @Autowired
    private StringRedisTemplate redisTemplate;

    @Override
    public Long getCount(Long id) {
        Long increment = redisTemplate.opsForValue().increment("VIEW" + id);
        return increment;
    }
}
